/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
 *
 */

import { BuildOption, HapOhosConfig, HarOhosConfig, HspOhosConfig, ModuleOhosConfig } from '../../options/build/hap-ohos-config.js';

export class ModuleOhosConfigManager {
  private configMap: Map<string, ModuleOhosConfig> = new Map<string, HapOhosConfig | HspOhosConfig | HarOhosConfig>();

  loaderConfig(moduleName: string, config: ModuleOhosConfig) {
    this.configMap.set(moduleName, config);
  }

  getBuildOption(moduleName: string): BuildOption | undefined {
    return this.configMap.get(moduleName)?.overrides?.buildOption;
  }

  getConfig(moduleName: string): ModuleOhosConfig | undefined {
    return this.configMap.get(moduleName);
  }
}

export const moduleOhosConfigManager = new ModuleOhosConfigManager();
